package dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import java.util.Vector;

import org.omg.CORBA.INTERNAL;

import model.*;
import util.ConnectDataBase;

public class RommDAO  {
	Vector listroom;
	ConnectDataBase connectDataBase;
	

	public RommDAO() {
		listroom = new Vector();
		connectDataBase= new ConnectDataBase();
		
	}
	public Vector getListroom() {
		try {
			
			ResultSet rs = connectDataBase.query_select("Select * from Room");
			while (rs.next()) {

				int room_id = rs.getInt("room_id");
				String category_id = rs.getString("category_id");
				long price = rs.getLong("price");
				String description = rs.getString("description");
				int status = Integer.parseInt(rs.getString("status"));

				Room r = new Room(room_id, category_id, price, description,
						status);
				listroom.add(r);
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return listroom;
	}

	public void setListroom(Vector listroom) {
		this.listroom = listroom;
	}

}
